Repository navigation
Match LIFT list values ignoring surrounding whitespace - #1200
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1200 +/- ##
==========================================
+ Coverage 40.09% 40.12% +0.02%
==========================================
Files 1544 1544
Lines 355309 355328 +19
Branches 41357 41364 +7
==========================================
+ Hits 142475 142574 +99
+ Misses 183533 183468 -65
+ Partials 29301 29286 -15
🚀 New features to boost your workflow:
|
LIFT import matched list items, such as semantic domains, only on exact text. Semantic domain lists from FieldWorks templates before 2017 have trailing spaces in some English names (e.g., "Necessary "), so a LIFT value of "9.4.2.3 Necessary" from another program created a duplicate domain instead of linking to the existing one. Also key possibility lookups on names and abbreviations trimmed of surrounding whitespace, and fall back to the trimmed value when looking up a trait. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Storing trimmed aliases in the possibility maps let an alias claim a key before an item whose name matches exactly, and items created during import got no alias, so whitespace variants within one file still created duplicates. Keep the maps as built from the project, and only when the exact and lowercase lookups miss, scan for a key that matches once trimmed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolving the old entry-type trait looked up complex form and variant types by exact or lowercase text only, so an existing variant type "Foo " was missed and a new complex form type "Foo" was created. Use the same lookup as the other LIFT trait values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolving an old entry-type value checked complex form types first, including a trimmed match, so a complex form type "Foo " beat a variant type that matched "Foo" exactly. Try exact matches on both lists before trimmed matches on either; complex form types still win at equal strength. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
imnasnainaec
force-pushed
the
lift-import-trim-possibility-names
branch
from
October 28, 2026 15:50
13023b8 to
285bea5
Compare
When a padded trait value such as "Foo " has no untrimmed match, look up the trimmed value directly before scanning the map. A key with no surrounding whitespace then wins over other keys that only match once trimmed, whatever order they were added in. Rename TryGetPossibilityMatchingExactly to TryGetPossibilityMatchingUntrimmed, since it also matches the lowercase form. Add tests for the complex form side of old entry-type lookup, the tie between complex form and variant types, minor-entry-condition subtypes, the no-match fallbacks, case-insensitive trimmed matching and padded part-of-speech names. Group the tests by behavior, name them with "Padded" for stray whitespace, and give the semantic domain senses fixed ids. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
imnasnainaec
marked this pull request as ready for review
October 28, 2026 16:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FieldWorks semantic domain templates before 2017 have trailing spaces in 16 English names (
"Necessary ","Animism ", ...), and projects created then still have them. The Combine writes the trimmed9.4.2.3 Necessaryto LIFT (sillsdev/TheCombine#4410). That misses FLEx's key9.4.2.3 Necessary, so import adds a duplicate domain.The maps are unchanged, so an untrimmed match always wins. The scan runs only after every direct lookup misses; hits aren't cached, so a value that matches only after trimming rescans on each occurrence.
Evidence
New tests in
LiftMergerTestscover padded names in semantic domains, parts of speech and both entry-type lists, the precedence rules above, whitespace variants within one file,minor-entry-conditionsubtypes, and the no-match fallbacks.ImportSemanticDomainTrait_MatchesExistingDomainWithPaddedNameon main:Should not create a new semantic domain. Expected: property Count equal to 1 But was: 2LiftMergerTestsandLiftMergerRelationTests: 79 passed, 0 failed, 2 skipped (TestLiftImport9C/9D, which skip themselves).Merge Danger
Door: two-way. Import-time matching only; no model or data migration.
Blast Radius: LIFT import. The trimmed fallback applies to every list matched through
TryGetPossibilityMatchingTrait(semantic domains, parts of speech, entry types, anthropology codes, dialects, usage types, locations and the rest), not just semantic domains.Out of scope, still matched without trimming: reversal parts of speech, lexical relation types, exception features, morph types, list-valued custom fields,
minor-entry-conditionsubtypes, and the old entry-type special cases (Derivation,main entry, ...).Considered and rejected
ProcessSemanticDomainmatches range elements only by guid. That's separate, pre-existing behavior.🤖 Generated with Claude Code
This change is